﻿using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using System;

namespace Spark.Samples.WebApi
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)

                //.ConfigureAppConfiguration(
                //    (hostingContext, builder) =>
                //    {
                //        //获取全局变量
                //        builder.AddRemoteConfig(
                //            options =>
                //            {
                //                options.AppCode = Environment.GetEnvironmentVariable("AppCode");
                //                options.Key = "GlobalConfig";
                //                options.Optional = true;
                //                options.ReloadOnChange = true;
                //                options.Url = Environment.GetEnvironmentVariable("ConfigUrl");
                //                options.Interval = 10000;
                //            });
                //    })
                //.ConfigureLogging(
                //    (hostingContext, logging) =>
                //    {
                //        logging.AddConfiguration(hostingContext.Configuration.GetSection("GlobalConfig:Logging"));
                //    })
                .UseStartup<Startup>();
    }
}